namespace testweb
{
    public delegate T Delegateformap<T>(T item);
    public delegate bool Delegateforselect<T>(T item);

    class RubyList<T> : List<T>
    {
        public RubyList()
        {
        }
        public RubyList(IList<T> list)
        {
            this.Clear();
            for (int i = 0; i < list.Count; i++)
            {
                this.Add(list[i]);
            }
        }
        public List<T> List
        {
            get { return this as List<T>; }
        }
        public RubyList<T> map(Delegateformap<T> act)
        {
            RubyList<T> ret = new RubyList<T>();
            for (int i = 0; i < this.Count; i++)
                ret.Add(act(this[i]));
            return ret;
        }
        public RubyList<T> select(Delegateforselect<T> act)
        {
            RubyList<T> ret = new RubyList<T>();
            for (int i = 0; i < this.Count; i++){
                if (act(this[i]))
                    ret.Add(this[i]);
            }
            return ret;
        }
    }

    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            RubyList<string> str = new RubyList<string>();
            str.Add("Comablade");
            str.Add("Naver.com");
            str.Add("Parkoz");

            RubyList<string> kj = str.select(delegate(string item) { return item.Contains("Parkoz"); });
            kj.ForEach(Response.Write);
        }
    }
}

